﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BusinessObjects.BO_GetObjects;
using LibraryO2S;
using System.IO;

public partial class controls_admin_VoteView : Pages_Base
{
    private DataTable objDT;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            loadVote();
    }
    private void loadVote()
    {
        try
        {
            string path = Server.MapPath("~/upload/xml/vote.xml");
            if (!File.Exists(path))
                return;
            DataSet objDS = new DataSet();
            objDS.ReadXml(path);
            if (objDS != null && objDS.Tables.Count > 1)
            {
                objDT = objDS.Tables[1];
                divQues.InnerHtml = objDS.Tables[0].Rows[0]["QUESTION"].ToString() + "<br />" + "Tổng số phiếu bầu: <font color='blue' >" + objDS.Tables[0].Rows[0]["TOTAL"].ToString() + "</font>";
                bindRepeater(rptVote, objDT, divMessage);
            }
        }
        catch (Exception ex)
        {
            divMessage.InnerHtml = O2S_Message.Error("Lỗi", "Phát hiện lỗi :<br />" + ex.Message);
        }
    }
}
